BrowserView

fun BrowserView(state: BrowserViewState, modifier: <Error class: unknown class> = Modifier)
fun BrowserView(state: BrowserViewState, modifier: <Error class: unknown class> = Modifier)

Displays the browser content from the provided state.

This composable is stateless, meaning that users are responsible for managing the state. A convenient way to create the state is by using rememberBrowserViewState, which handles cleanup automatically. An example usage:

val state = rememberBrowserViewState(browser)
BrowserView(state)

Alternatively, the state can be created and remembered directly, though it must be manually closed when no longer needed:

val state = remember(browser) {
BrowserViewState(browser, scope, window, dragAndDropEnabled)
}
BrowserView(state)
DisposableEffect(state) {
onDispose {
state.close()
}
}

A state instance can only be associated with one BrowserView at a time. An attempt to display multiple views with the same state leads to a runtime exception.

The passed modifier supports all the same options as the Box composable. You can use it to adjust properties like size, padding, alignment, and more.

Since

8.0.0

Parameters

state

The state of the browser view.

modifier

The modifier to be applied to the layout.


fun <Error class: unknown class>.BrowserView(browser: Browser, modifier: <Error class: unknown class> = Modifier, dragAndDropEnabled: Boolean = true)
fun <Error class: unknown class>.BrowserView(browser: Browser, modifier: <Error class: unknown class> = Modifier, dragAndDropEnabled: Boolean = true)

Displays the content of the given browser.

This composable is stateful, meaning it manages the state internally. The state is created when the BrowserView enters the composition, and it is released when the view leaves the composition. Please note that the view recreates the state and recomposes for each different browser instance provided. State preservation can be achieved by using state hoisting.

This composable needs a WindowScope to access the native AWT window. This access enables the BrowserView to utilize native AWT capabilities, such as handling specific window events and accessing window properties.

Please note, as for now, the composable supports only OFF_SCREEN rendering mode. Passing a browser instance with HARDWARE_ACCELERATED mode leads to a runtime exception. See also: Rendering modes.

Since

8.0.0

Parameters

browser

The browser, whose content is to be displayed.

modifier

The modifier to be applied to the layout.

dragAndDropEnabled

A flag indicating whether drag-and-drop functionality is enabled.